<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    function maxArea (height) {
      let max = []
      for(let i = 0; i < height.length; i++) {
        let Arrsum =[]
        // let sum = 0
        for(let j = i+1; j < height.length; j++) {
        let min = Math.min(height[i], height[j])
        Arrsum.push(min*(j-i))
      }
      max.push(Math.max(...Arrsum))

}
console.log(Math.max(...max));
    }
let num =[1,8,6,2,5,4,8,3,7]
maxArea(num)

  </script>
</body>
</html>